home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / borland / svgabg52.zip / INITSVGA.PAS < prev    next >
Pascal/Delphi Source File  |  1993-10-04  |  4KB  |  178 lines

  1. { Sample program that initializes the SuperVGA driver}
  2. Program Test256;
  3.  
  4. Uses Graph,Crt,Dos;
  5.  
  6. {$i svga16.inc}
  7. {$i svga256.inc}
  8. {$i svga32k.inc}
  9. {$i svga_put.inc}
  10.  
  11. (* Uncomment this if you link in the drivers *)
  12. (*
  13. procedure Svga16_driver; external;
  14. { $L svga16.obj }
  15.  
  16. procedure Svga256_driver; external;
  17. { $L svga256.obj }
  18.  
  19. procedure Twk256_driver; external;
  20. { $L twk256.obj }
  21.  
  22. procedure Twk16_driver; external;
  23. { $L twk16.obj }
  24.  
  25. procedure Svga32k_driver; external;
  26. { $L svga32k.obj }
  27.  
  28. procedure SvgaS3_driver; external;
  29. { $L svgas3.obj }
  30. *)
  31.  
  32. var
  33.   GraphMode, GraphDriver : integer;
  34.   Ky : Char;
  35.   Drv : Integer;
  36.  
  37. function WhitePixel : Word;
  38. begin
  39.   if (GetMaxColor > 256) then
  40.     WhitePixel := 32767
  41.   else
  42.     WhitePixel := 15;
  43. end;
  44.  
  45. {$F+}
  46. function DetectVGA256 : Integer;
  47. var Vid : Integer;
  48.  
  49. begin
  50.   Writeln('Which video mode would you like to use?');
  51.   Writeln('  0) 320x200x256');
  52.   Writeln('  1) 640x400x256');
  53.   Writeln('  2) 640x480x256');
  54.   Writeln('  3) 800x600x256');
  55.   Writeln('  4) 1024x768x256');
  56.   Writeln('  5) 640x350x256');
  57.   Writeln('  6) 1280x1024x256');
  58.   Write('> ');
  59.   Readln(Vid);
  60.   DetectVGA256 := Vid;
  61. end;
  62.  
  63. function DetectS3 : Integer;
  64. var Vid : Integer;
  65.  
  66. begin
  67.   Writeln('Which video mode would you like to use?');
  68.   Writeln('  0) 640x480x256');
  69.   Writeln('  1) 800x600x256');
  70.   Writeln('  2) 1024x768x256');
  71.   Writeln('  3) 800x600x16');
  72.   Writeln('  4) 1024x768x16');
  73.   Writeln('  5) 1280x960x16');
  74.   Writeln('  6) 1280x1024x16');
  75.   Writeln('  7) 640x480x32768');
  76.   Write('> ');
  77.   Readln(Vid);
  78.   DetectS3 := Vid;
  79. end;
  80.  
  81. function DetectVGA32k : Integer;
  82. var Vid : Integer;
  83.  
  84. begin
  85.   Writeln('Which video mode would you like to use?');
  86.   Writeln('  0) 320x200x32768');
  87.   Writeln('  1) 640x350x32768');
  88.   Writeln('  2) 640x400x32768');
  89.   Writeln('  3) 640x480x32768');
  90.   Writeln('  4) 800x600x32768');
  91.   Write('> ');
  92.   Readln(Vid);
  93.   DetectVGA32k := Vid;
  94. end;
  95.  
  96.  
  97. function DetectVGA16 : Integer;
  98. var Vid : Integer;
  99.  
  100. begin
  101.   Writeln('Which video mode would you like to use? ');
  102.   Writeln('  0) 320x200x16');
  103.   Writeln('  1) 640x200x16');
  104.   Writeln('  2) 640x350x16');
  105.   Writeln('  3) 640x480x256');
  106.   Writeln('  4) 800x600x16');
  107.   Writeln('  5) 1024x768x16');
  108.   Writeln('>');
  109.   Readln(Vid);
  110.   DetectVGA16 := Vid;
  111. end;
  112.  
  113. function DetectTwk256 : Integer;
  114. var Vid : Integer;
  115.  
  116. begin
  117.   Writeln('Which video mode would you like to use?');
  118.   Writeln('  0) 320x400x256');
  119.   Writeln('  1) 320x480x256');
  120.   Writeln('  2) 360x480x256');
  121.   Writeln('  3) 376x564x256');
  122.   Writeln('  4) 400x564x256');
  123.   Writeln('  5) 400x600x256');
  124.   Writeln('  6) 320x240x256');
  125.   Write('> ');
  126.   Readln(Vid);
  127.   DetectTwk256 := Vid;
  128. end;
  129.  
  130. function DetectTwk16 : Integer;
  131. var Vid : Integer;
  132.  
  133. begin
  134.   Writeln('Which video mode would you like to use? ');
  135.   Writeln('  0) 704x528x16');
  136.   Writeln('  1) 720x540x16');
  137.   Writeln('  2) 736x552x16');
  138.   Writeln('  3) 752x564x256');
  139.   Writeln('  4) 768x576x16');
  140.   Writeln('  5) 784x588x16');
  141.   Writeln('  6) 800x600x16');
  142.   Writeln('>');
  143.   Readln(Vid);
  144.   DetectTwk16 := Vid;
  145. end;
  146. {$F-}
  147.  
  148. begin
  149.   Writeln('Which driver would you like to use?');
  150.   Writeln('  0) Svga256');
  151.   Writeln('  1) Svga16');
  152.   Writeln('  2) Tweak256');
  153.   Writeln('  3) Tweak16');
  154.   Writeln('  4) Svga32k');
  155.   Writeln('  5) SvgaS3');
  156.   Write('>');
  157.   Readln(Drv);
  158.   if (Drv = 0) then
  159.     GraphDriver := InstallUserDriver('SVGA256',@DetectVGA256)
  160.   else if (Drv = 1) then
  161.     GraphDriver := InstallUserDriver('SVGA16',@DetectVGA16)
  162.   else if (Drv = 2) then
  163.     GraphDriver := InstallUserDriver('Twk256',@DetectTwk256)
  164.   else if (Drv = 3) then
  165.     GraphDriver := InstallUserDriver('Twk16',@DetectTwk16)
  166.   else if (Drv = 4) then
  167.     GraphDriver := InstallUserDriver('Svga32k',@DetectVGA32k)
  168.   else if (Drv = 5) then
  169.     GraphDriver := InstallUserDriver('SvgaS3',@DetectS3);
  170.   GraphDriver := Detect;
  171.   InitGraph(GraphDriver,GraphMode,'');
  172.   setcolor(RealDrawColor(WhitePixel));
  173.   line(0,0,GetMaxX,GetMaxY);
  174.   line(0,GetMaxY,GetMaxX,0);
  175.   Ky := ReadKey;
  176.   CloseGraph;
  177. end.
  178.